package com.car.controller;

import com.car.entity.Billing;
import com.car.entity.Product;
import com.car.service.ISeachService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class SeachMapperController {
    @Autowired
    @Qualifier(value = "seachService")
    private ISeachService iSeachService;

    @RequestMapping(value = "/As")
    public String Seach(Model model){

        List<Billing> cill=iSeachService.cill();
        model.addAttribute("cill",cill);

        List<Product> findproductall = iSeachService.findproductall();
        model.addAttribute("findproductall",findproductall);

        int findchu = iSeachService.findchu();
        model.addAttribute("findchu",findchu);

        int findnian = iSeachService.findnian();
        model.addAttribute("findnian",findnian);

        int findmoney = iSeachService.findmoney();
        model.addAttribute("findmoney",findmoney);

        int findcar = iSeachService.findcar();
        model.addAttribute("findcar",findcar);

        List<Billing> findc = iSeachService.findc();
        model.addAttribute("findc",findc);

        int bills = iSeachService.bills();
        model.addAttribute("bills",bills);

        int findsh = iSeachService.findsh();
        model.addAttribute("findsh",findsh);
        return "sale_Search.jsp";

    }
    @RequestMapping("/AS1")
    public  String sea(Model model,String regtime ,String regtime1){
        List<Billing> cills=iSeachService.cills(regtime,regtime1);
        model.addAttribute("cill",cills);

        List<Product> findproductalls = iSeachService.findproductalls(regtime,regtime1);
        model.addAttribute("findproductall",findproductalls);

        String findchus = iSeachService.findchus(regtime,regtime1);
        model.addAttribute("findchu",findchus);

        String findnians = iSeachService.findnians(regtime,regtime1);
        model.addAttribute("findnian",findnians);

        String findmoneys = iSeachService.findmoneys(regtime,regtime1);
        model.addAttribute("findmoney",findmoneys);

        String findcars = iSeachService.findcars(regtime,regtime1);
        model.addAttribute("findcar",findcars);

        List<Billing> findcs = iSeachService.findcs(regtime,regtime1);
        model.addAttribute("findc",findcs);

        String billss = iSeachService.billss(regtime,regtime1);
        model.addAttribute("bills",billss);

        String findshs = iSeachService.findshs(regtime, regtime1);
        model.addAttribute("findsh",findshs);

        return "sale_Search.jsp";
    }

}
